<?php
/**
 * @file views-view--view-by-clients.tpl.php
 * View for "View by Clients"
 *
 * Variables available:
 * - $classes_array: An array of classes determined in
 *   template_preprocess_views_view(). Default classes are:
 *     .view
 *     .view-[css_name]
 *     .view-id-[view_name]
 *     .view-display-id-[display_name]
 *     .view-dom-id-[dom_id]
 * - $classes: A string version of $classes_array for use in the class attribute
 * - $css_name: A css-safe version of the view name.
 * - $css_class: The user-specified classes names, if any
 * - $header: The view header
 * - $footer: The view footer
 * - $rows: The results of the view query, if any
 * - $empty: The empty text to display if the view is empty
 * - $pager: The pager next/prev links to display, if any
 * - $exposed: Exposed widget form/info to display
 * - $feed_icon: Feed icon to display, if any
 * - $more: A link to view more, if any
 *
 * @ingroup views_templates
 */

global $base_url;


switch(arg(0)){
	case "our_work":
		//this is for the Clients Listing Page;
		$term = taxonomy_vocabulary_machine_name_load(arg(1));
		
		//this is for the ALL Projects Page... accessible through modding URL;
		if(empty($term)){$term = taxonomy_vocabulary_load(3);}
		
		break;
	case "taxonomy":	
		$term = taxonomy_term_load(arg(2));
		//print arg(1);
		break;
	/*case "project_detail":
		if($_GET['term']!=""){
			$term = taxonomy_term_load(arg(2));
			
		}else{
			$term = taxonomy_term_load(3); //3 is the VID for Cause
		}
		break;
	*/
	
	default:
		if(!isset($_GET['term'])){
			//if 'term' is not set in the URL address
			$term = $term = taxonomy_vocabulary_load(3);
		}else{
			switch ($_GET['term']){
				case (empty($_GET['term'])):
					$term = taxonomy_term_load(3); //3 is the VID for Cause	
					break;
				case (!NULL):
					$term = taxonomy_term_load($_GET['term']);
					break;
				default :
					$term = taxonomy_vocabulary_load(3);
					break;
			}
		}
}

$activeVID = $term->vid;
$rowVID=$view->result[0]->taxonomy_term_data_vid;
?>

  <div class="section-title<?php if($view->result[0]->taxonomy_vocabulary_machine_name=="clients"){print "-nomenu";}?> <?php print $view->result[0]->taxonomy_vocabulary_machine_name;?>">
    <a href="<?php print $base_url;?>/our_work/<?php print $view->result[0]->taxonomy_vocabulary_machine_name;?>" class="<?php if($activeVID==$rowVID){print "active";}?>">List by <?php print $view->result[0]->taxonomy_vocabulary_name;?></a>
  </div>

  <?php if ($rows): ?>
      <?php print $rows; ?>

  <?php elseif ($empty): ?>
      <?php print $empty; ?>
  <?php endif; ?>
